package cn.net.lisong.blog.controller;

import java.io.IOException;
import java.io.PrintWriter;
import java.util.Enumeration;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class ArticleServlet  extends HttpServlet {

	private static final long serialVersionUID = 1L;

	@Override
	protected void doGet(HttpServletRequest req, HttpServletResponse resp)
			throws ServletException, IOException {
		Enumeration<String> hns = req.getHeaderNames();
		StringBuilder sb = new StringBuilder();
		sb.append("<table>");
		while (hns.hasMoreElements()) {
			sb.append("<tr>");
			sb.append("<td>");
			String hd = (String) hns.nextElement();
			sb.append(hd);
			sb.append("</td>");
			sb.append("<td>");
			String val = req.getHeader(hd);
			sb.append(val);
			sb.append("</td>");
			sb.append("</tr>");
		}
		sb.append("</table>");
		PrintWriter writer = resp.getWriter();
		writer.write(sb.toString());
		writer.close();
	}

	@Override
	protected void doPost(HttpServletRequest req, HttpServletResponse resp)
			throws ServletException, IOException {
		   
	}

}
